package com.bw.exam.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bw.exam.pojo.ItemCat;
import com.bw.exam.result.R;
import com.bw.exam.service.ItemCatService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/business/itemcat")
public class ItemCatController {

    @Resource
    ItemCatService itemCatService;

    @RequestMapping("byPid/{pid}")
    public R byPid(@PathVariable Long pid){
        LambdaQueryWrapper<ItemCat> queryWapper = new LambdaQueryWrapper<>();
        queryWapper.eq(ItemCat::getParentId,pid);
        List<ItemCat> list = itemCatService.list(queryWapper);
        return R.success(list);
    }

}
